<!--
 * @Author: weidewei
 * @Date: 2025-05-13 17:39:52
 * @LastEditors: weidewei
 * @LastEditTime: 2025-05-13 17:57:15
 * @Description: 
 * @FilePath: \2025-front-face\vue\vue2\v2\src\components\TestEmitComp.vue
-->
<template>
    <div>
        <button @click="getData">点击获取数据</button>
        <h3>获取到的数据是：{{ emitData }}</h3>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                
            }
        },
        props: ["emitData"],
        methods: {
            getData() {
                // 公式：Math.floor(Math.random() * (最大值 - 最小值 + 1)) + 最小值
                this.$emit("getData", Math.floor(Math.random() * 100) + 1)
            }
        }
    }
</script>